﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;

namespace Eniux.Windows.ThreeDEngine.AttachObject
{
    public  class AttachBase:DependencyObject
    {
        #region Text(文本)
        /// <summary>
        /// 文本属性
        /// </summary>
        public static readonly DependencyProperty TextProperty = DependencyProperty.RegisterAttached("Text", typeof(string), typeof(AttachBase), new PropertyMetadata(""));

        /// <summary>
        /// 设置给定依赖对象的Text附加属性的值
        /// </summary>
        /// <param name="element">依赖对象</param>
        /// <param name="value">值</param>
        public static void SetText(DependencyObject element, string value)
        {
            element.SetValue(TextProperty, value);
        }

        /// <summary>
        /// 获取给定依赖对象的Text附加属性的值
        /// </summary>
        /// <param name="element">依赖对象</param>
        /// <returns>Text附加属性的值</returns>
        public static string GetText(DependencyObject element)
        {
            return (string)element.GetValue(TextProperty);
        }
        #endregion

        #region Flag(标志)
        /// <summary>
        /// 标志属性
        /// </summary>
        public static readonly DependencyProperty FlagProperty = DependencyProperty.RegisterAttached("Flag", typeof(object), typeof(AttachBase), new PropertyMetadata(""));

        /// <summary>
        /// 设置给定依赖对象的Flag附加属性的值
        /// </summary>
        /// <param name="element">依赖对象</param>
        /// <param name="value">值</param>
        public static void SetFlag(DependencyObject element, object value)
        {
            element.SetValue(FlagProperty, value);
        }

        /// <summary>
        /// 获取给定依赖对象的Flag附加属性的值
        /// </summary>
        /// <param name="element">依赖对象</param>
        /// <returns>Flag附加属性的值</returns>
        public static object GetFlag(DependencyObject element)
        {
            return (object)element.GetValue(FlagProperty);
        }
        #endregion
    }
}
